from django.db import models
from easy_thumbnails.fields import ThumbnailerField
# Create your models here.
from django.utils.translation import ugettext as _
import datetime

class Contact(models.Model):
    name    =   models.CharField(_('Name'),help_text=_("title"),max_length=255)
    email =     models.CharField(_('Short description'),max_length=255)
    message = models.TextField(_("Message") )
    def __unicode__(self):
        return self.name + "::" + self.email

class Media(models.Model):
    
    IMAGE_TYPE = 0
    VIDEO_TYPE = 1
    TYPES = (
                (IMAGE_TYPE, _('image')),
                (VIDEO_TYPE, _('video'))
             )

    type = models.IntegerField(_("Media Type"), max_length=1, choices=TYPES)
    item_name = models.CharField(_("Name"), help_text=_("Media Item name"), max_length=100)
    add_time = models.DateTimeField(_("Time"), help_text=_("Addition time"), default=datetime.datetime.now())
    item_file_name = ThumbnailerField(_("File name"), help_text=_("Media item file name"), upload_to="media_items")

    def __unicode__(self):
        return self.item_name + "::" + self.item_name

    class Meta:
        verbose_name = _('Media Item')
        verbose_name_plural = _('Media Items')

        
        
class Fragrance(models.Model):
    title    = models.CharField(_('Name'),help_text=_("title"),max_length=255)
    short_description = models.CharField(_('Short description'),max_length=255)
    description =  models.TextField(_('Description'),help_text=_("title"),max_length=511)
    picture = ThumbnailerField(_('picture'), upload_to="images/Fragrances")
    price = models.FloatField(_('price') )
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    media = models.ManyToManyField(Media , verbose_name=_('Media'))
    class Meta:
        verbose_name = _('fragrance')
        verbose_name_plural = _('fragrances')
        db_table = 'fragrance'

    def __unicode__(self):
        return self.title
    def scaffold(self):
        '''
        returns a settings dictionary.  If not provided, a default is used with create, detail, list
        views - a list of which views to create, either as strings, dicts, lists, or a combination
        '''

        return {
            "build_list": [
                    {"recipe": "detail", "name": "view", "overrides": 
                        {},
                    },
                    "create",
                    "edit",
                    "list",
                    ],
            "overrides": None,
            }
class Paper(models.Model):
    title    = models.CharField(_('Name'),help_text=_("Branch name"),max_length=255)
    description =  models.CharField(_('Description'),help_text=_("Branch name"),max_length=255)
    short_description = models.CharField(_('Short description'),max_length=255)
    picture = ThumbnailerField(_('picture'), upload_to="images/Papers")
    price = models.TextField(_('Address'),help_text=_("Company's address ex:9 somestreet city, state, country"))
    type =   models.CharField(_('Type'),max_length=255)
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    media = models.ManyToManyField(Media , verbose_name=_('Media'))
    class Meta:
        verbose_name = _('Paper')
        verbose_name_plural = _('Papers')
        db_table = 'Papers'

    def __unicode__(self):
        return self.title
    def scaffold(self):
        '''
        returns a settings dictionary.  If not provided, a default is used with create, detail, list
        views - a list of which views to create, either as strings, dicts, lists, or a combination
        '''

        return {
            "build_list": [
                    {"recipe": "detail", "name": "view", "overrides": 
                        {},
                    },
                    "create",
                    "edit",
                    "list",
                    ],
            "overrides": None,
            }
class News(models.Model):
    title    = models.CharField(_('Name'),help_text=_("Branch name"),max_length=255)
    description =  models.CharField(_('Description'),help_text=_("Branch name"),max_length=255)
    short_description = models.CharField(_('Short description'),max_length=255)   
    picture = ThumbnailerField(_('picture'), upload_to="images/News")
    price = models.TextField(_('Address'),help_text=_("Company's address ex:9 somestreet city, state, country"))
    created = models.DateTimeField(auto_now_add=True)
    modified = models.DateTimeField(auto_now=True)
    media = models.ManyToManyField(Media , verbose_name=_('Media'))
    class Meta:
        verbose_name = _('News')
        verbose_name_plural = _('News')
        db_table = 'News'

    def __unicode__(self):
        return self.title

    def scaffold(self):
        '''
        returns a settings dictionary.  If not provided, a default is used with create, detail, list
        views - a list of which views to create, either as strings, dicts, lists, or a combination
        '''

        return {
            "build_list": [
                    {"recipe": "detail", "name": "view", "overrides": 
                        {},
                    },
                    "create",
                    "edit",
                    "list",
                    ],
            "overrides": None,
            }
            
